import Vue from 'vue'
import VueRouter from 'vue-router'
import store from '@/store'
import {
	constantRouterMap
} from "@/config/router.config"
import {
	UserLayout,
	Dashboard,
	Default,
	// BlankLayout
} from '@/components/layouts'
import { getAsyncRoutes } from '@/api/routes'

Vue.use(VueRouter)

export const asyncRouterMap = [

	{ // 首页默认菜单
		path: '/baseData',
		component: Default,
		meta: {
			title: '基础信息管理',
			breadcrumbs: ['公共系统', '基础信息管理'],
			roles: ['system', 'ceshi']
		},
		redirect: '/baseData/index',
		children: [{
				//用户管理
				path: '/baseData/index',
				meta: {
					title: '学校基础信息',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '学校基础信息'],
				},
				name: 'schoolInfo',
				component: () => import('@/views/common/basicsData/schoolInfo/index')
			}, {
				path: '/baseData/schoollMsg/index',
				meta: {
					title: '校区信息',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '校区信息'],
				},
				name: 'schoollMsg',
				component: () => import('@/views/common/basicsData/schoollMsg/index')
			}, {
				path: '/baseData/department/index',
				meta: {
					title: '部门管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '部门管理'],
				},
				name: 'department',
				component: () => import('@/views/common/basicsData/departmentManagement/index')
			}, {
				path: '/baseData/schoolSystem/index',
				meta: {
					title: '学制管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '学制管理'],
				},
				name: 'schoolSystem',
				component: () => import('@/views/common/basicsData/schoolSystem/index')
			},
			{
				path: '/baseData/semester/index',
				meta: {
					title: '学期管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '学期管理'],
				},
				name: 'semester',
				component: () => import('@/views/common/basicsData/semester/index')
			}, {
				path: '/baseData/schoolFaculties/index',
				meta: {
					title: '院系管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '院系管理'],
				},
				name: 'schoolFaculties',
				component: () => import('@/views/common/basicsData/schoolFaculties/index')
			}, {
				path: '/baseData/schoolClass/index',
				meta: {
					title: '年级管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '年级管理'],
				},
				name: 'schoolClass',
				component: () => import('@/views/common/basicsData/schoolClass/index')
			}, {
				path: '/baseData/schoolSpecialized/index',
				meta: {
					title: '专业管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '专业管理'],
				},
				name: 'schoolSpecialized',
				component: () => import('@/views/common/basicsData/schoolSpecialized/index')
			}, {
				path: '/baseData/zyzInfo/index',
				meta: {
					title: '专业组管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '专业组管理'],
				},
				name: 'zyzInfo',
				component: () => import('@/views/common/basicsData/zyz/index')
			}, {
				path: '/baseData/classManage/index',
				meta: {
					title: '班级管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '班级管理'],
				},
				name: 'classManage',
				component: () => import('@/views/common/basicsData/classManage/index')
			}, {
				path: '/baseData/teacherinfo/index',
				meta: {
					title: '教师管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '教师管理'],
				},
				name: 'teacherinfo',
				component: () => import('@/views/common/basicsData/teacherinfo/index')
			}, {
				path: '/baseData/stuInfo/index',
				meta: {
					title: '学生管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', '学生管理'],
				},
				name: 'stuInfo',
				component: () => import('@/views/common/basicsData/stuInfo/index')
			},
			{
				path: '/baseData/holidays/index',
				meta: {
					title: '',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', ''],
				},
				name: 'holidays',
				component: () => import('@/views/common/basicsData/holidays/index')
			},
			{
				path: '/baseData/holidays/index',
				meta: {
					title: '',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', ''],
				},
				name: 'holidays',
				component: () => import('@/views/common/basicsData/holidays/index')
			},
			{
				path: '/baseData/academicCalendar/index',
				meta: {
					title: '',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['基础信息管理', ''],
				},
				name: 'academicCalendar',
				component: () => import('@/views/common/basicsData/academicCalendar/index')
			},
		],
	}, {
		path: '/dorm',
		component: Default,
		meta: {
			title: '宿舍基础管理',
			breadcrumbs: ['宿舍系统', '宿舍基础管理'],
			roles: ['system', 'ceshi']
		},
		redirect: '/dorm/floorMng',
		children: [{
				path: '/dorm/buildMng',
				meta: {
					title: '宿舍楼管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍基础管理', '宿舍楼管理'],
				},
				name: 'buildMng',
				component: () => import('@/views/dorm/baseMng/buildMng')
			},
			{
				path: '/dorm/floorMng',
				meta: {
					title: '楼层管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍基础管理', '楼层管理'],
				},
				name: 'floorMng',
				component: () => import('@/views/dorm/baseMng/floorMng')
			},
			{
				path: '/dorm/dormMng',
				meta: {
					title: '宿舍管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍基础管理', '宿舍管理'],
				},
				name: 'dormMng',
				component: () => import('@/views/dorm/baseMng/dormMng')
			}
		]
	}, {
		path: '/dormProperty',
		component: Default,
		meta: {
			title: '宿舍资产管理',
			breadcrumbs: ['宿舍系统', '宿舍资产管理'],
			roles: ['system', 'ceshi']
		},
		redirect: '/dormProperty/assetTypeMng',
		children: [{
				path: '/dormProperty/assetTypeMng',
				meta: {
					title: '资产类别管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍资产管理', '资产类别管理'],
				},
				name: 'assetTypeMng',
				component: () => import('@/views/dorm/assetMng/assetTypeMng')
			},

			{
				path: '/dormProperty/assetMng',
				name: 'assetMng',
				meta: {
					title: '资产管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍资产管理', '资产管理'],
				},
				component: () => import('@/views/dorm/assetMng/assetMng')
			},
			{
				path: '/dormProperty/assetQuery',
				meta: {
					title: '资产查询',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['资产类别管理', '资产查询'],
				},
				name: 'assetQuery',
				component: () => import('@/views/dorm/assetMng/assetQuery')
			}
		]
	}, {
		path: '/dormsw',
		component: Default,
		meta: {
			title: '宿务管理',
			breadcrumbs: ['宿舍系统', '宿务管理'],
			roles: ['system', 'ceshi']
		},
		redirect: 'dormProperty/chooseDorm',
		children: [{
				path: '/dormProperty/chooseDorm',
				meta: {
					title: '',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍资产管理', '宿舍操作'],
				},
				name: 'chooseDorm',
				component: () => import('@/views/dorm/dormMng/chooseDorm')
			},
			{
				path: '/dormProperty/dormDistribute',
				meta: {
					title: '',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['资产类别管理', '分配学生'],
				},
				name: 'dormDistribute',
				component: () => import('@/views/dorm/dormMng/dormDistribute')
			},
			{
				path: '/dormProperty/chooseBuild',
				meta: {
					title: '选择宿舍',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍资产管理', '选择宿舍'],
				},
				name: 'chooseBuild',
				component: () => import('@/views/dorm/dormMng/chooseBuild')
			},

			{
				path: '/dormProperty/dormFixMng',
				name: 'dormFixMng',
				meta: {
					title: '',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍资产管理', '查看详情(宿舍维修)'],
				},
				component: () => import('@/views/dorm/dormMng/dormFixMng')
			}, {
				path: '/dormsw/dormModifyApply',
				meta: {
					title: '宿舍变更',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿务管理', '宿舍变更'],
				},
				name: 'dormModifyApply',
				component: () => import('@/views/dorm/dormMng/dormModifyApply')
			},
			{
				path: '/dormsw/mydormApply',
				meta: {
					title: '宿舍变更申请',
					roles: ['student', 'ceshi'],
					breadcrumbs: ['宿务管理', '宿舍变更申请'],
				},
				name: 'mydormApply',
				component: () => import('@/views/dorm/dormMng/mydormApply')
			},
			{
				path: '/dormsw/prinConditionMng',
				meta: {
					title: '违纪情况管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿务管理', '违纪情况管理'],
				},
				name: 'prinConditionMng',
				component: () => import('@/views/dorm/dormMng/prinConditionMng')
			},
			// {
			// 	path: '/dormsw/dormVisitorMng',
			// 	meta: {
			// 		title: '宿舍访客管理',
			// 		roles: ['system'],
			// 		breadcrumbs: ['宿务管理', '宿舍访客管理'],
			// 	},
			// 	component: () => import('@/views/dorm/dormMng/dormVisitorMng')
			// },
			// // 宿舍调用
			// {
			// 	path: '/dormsw/chooseBuildIndex',
			// 	meta: {
			// 		title: '宿舍分配',
			// 		roles: ['system'],
			// 		breadcrumbs: ['宿务管理', '宿舍分配'],
			// 	},
			// 	component: () => import('@/views/dorm/dormMng/chooseBuildIndex')
			// },
			// 宿舍调用
			{
				path: '/dormsw/dormInvoking',
				name: 'dormInvoking',
				meta: {
					title: '宿舍访客管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿务管理', '宿舍访客管理'],
				},
				component: () => import('@/views/dorm/dormMng/dormInvoking')
			},
			{
				path: '/dormsw/translateApprove',
				meta: {
					title: '留宿申请',
					roles: ['student'],
					breadcrumbs: ['宿务管理', '留宿申请'],
				},
				name: 'translateApprove',
				component: () => import('@/views/dorm/dormMng/translateApprove')
			},

			{
				path: '/dormsw/notice',
				meta: {
					title: '通知公告',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿务管理', '通知公告'],
				},
				name: 'notice',
				component: () => import('@/views/dorm/dormMng/notice')
			},
			{
				path: '/dorm/dormJudge',
				meta: {
					title: '宿舍卫生评比',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿务管理', '宿舍卫生评比'],
				},
				name: 'dormJudge',
				component: () => import('@/views/dorm/dormMng/dormJudge')
			}
		]
	}, {
		path: '/dormLodging',
		component: Default,
		meta: {
			title: '住宿考勤',
			breadcrumbs: ['宿舍系统', '住宿考勤'],
			roles: ['system', 'ceshi']
		},
		redirect: '/dormLodging/attenSetting',
		children: [{
				path: '/dormLodging/attenSetting',
				meta: {
					title: '考勤设置',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['住宿考勤', '考勤设置'],
				},
				name: 'attenSetting',
				component: () => import('@/views/dorm/accomAttendance/attenSetting')
			},
			{
				path: '/dormLodging/attenMng',
				meta: {
					title: '考勤管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['住宿考勤', '考勤管理'],
				},
				name: 'attenMng',
				component: () => import('@/views/dorm/accomAttendance/attenMng')
			},
			{
				path: '/dormLodging/prinTypeMng',
				meta: {
					title: '违纪类型管理',
					roles: ['system'],
					breadcrumbs: ['住宿考勤', '违纪类型管理'],
				},
				name: 'prinTypeMng',
				component: () => import('@/views/dorm/accomAttendance/prinTypeMng')
			},
			{
				path: '/dormLodging/prinMng',
				meta: {
					title: '留宿审核',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['住宿考勤', '违纪管理'],
				},
				name: 'prinMng',
				component: () => import('@/views/dorm/accomAttendance/prinMng')
			}
		]
	}, {
		path: '/dormInstitution',
		component: Default,
		meta: {
			title: '制度管理',
			breadcrumbs: ['宿舍系统', '制度管理'],
			roles: ['system', 'ceshi']
		},
		redirect: '/dormInstitution/ruleQuery',
		children: [{
				path: '/dormInstitution/ruleQuery',
				meta: {
					title: '制度查询',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['制度管理', '制度查询'],
				},
				name: 'ruleQuery',
				component: () => import('@/views/dorm/systemMng/ruleQuery')
			},
			{
				path: '/dormInstitution/dormRuleType',
				meta: {
					title: '寝室制度类别',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['制度管理', '寝室制度类别'],
				},
				name: 'dormRuleType',
				component: () => import('@/views/dorm/systemMng/dormRuleType')
			},
			{
				path: '/dormInstitution/ruleMng',
				meta: {
					title: '制度管理',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['制度管理', '制度管理'],
				},
				name: 'ruleMng',
				component: () => import('@/views/dorm/systemMng/ruleMng')
			}
		]
	}, {
		path: '/dormStatistics',
		component: Default,
		meta: {
			title: '宿舍统计',
			breadcrumbs: ['宿舍系统', '宿舍统计'],
			roles: ['system', 'ceshi']
		},
		redirect: '/dormStatistics/dormVolume',
		children: [{
				path: '/dormStatistics/dormVolume',
				meta: {
					title: '宿舍容量统计',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍统计', '宿舍容量统计'],
				},
				name: 'ruleQuery',
				component: () => import('@/views/dorm/dormCount/dormVolume')
			},
			{
				path: '/dormStatistics/stuCount',
				meta: {
					title: '宿舍学生统计',
					roles: ['system', 'ceshi'],
					breadcrumbs: ['宿舍统计', '宿舍学生统计'],
				},
				name: 'stuCount',
				component: () => import('@/views/dorm/dormCount/stuCount')
			},
			{
				path: '/dormStatistics/attenCount',
				meta: {
					title: '考勤统计',
					roles: ['system'],
					breadcrumbs: ['宿舍统计', '考勤统计'],
				},
				name: 'attenCount',
				component: () => import('@/views/dorm/dormCount/attenCount')
			},
			{
				path: '/dormStatistics/prinCount',
				meta: {
					title: '违纪统计',
					roles: ['system'],
					breadcrumbs: ['宿舍统计', '违纪统计'],
				},
				name: 'prinCount',
				component: () => import('@/views/dorm/dormCount/prinCount')
			}
		]
	},
	{ // 首页默认菜单
		path: '/userRole',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '用户角色管理'],
			roles: ['system']
		},
		redirect: '/userRole/operationLog/index',
		children: [{
				//用户管理
				path: '/userRole/operationLog/index',
				meta: {
					title: '用户管理',
					roles: ['system'],
					breadcrumbs: ['用户角色管理', '用户管理'],
				},
				name: 'operationLog',
				component: () => import('@/views/common/operationLog/index')
			},
			{
				//角色管理
				path: '/userRole/menuConfiguration/index',
				meta: {
					title: '角色管理',
					roles: ['system'],
					breadcrumbs: ['用户角色管理', '角色管理'],
				},
				name: 'menuConfiguration',
				component: () => import('@/views/common/menuConfiguration/index')
			},
			// {
			// 	path: '/common/permissionManage/index',
			// 	meta: {
			// 		title: '菜单管理',
			// 		roles: ['system'],
			// 		breadcrumbs: ['系统管理', '菜单管理'],
			// 	},
			// 	name: 'permissionManage',
			// 	component: () => import('@/views/common/permissionManage/index')
			// },
		]
	},
	{ // 首页默认菜单
		path: '/dictionary',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '数字字典管理'],
			roles: ['system']
		},
		redirect: '/dictionary/operationLog/index',
		children: [{
			//字典管理
			path: '/dictionary/dictionaryManagement/index',
			meta: {
				title: '字典管理',
				roles: ['system'],
				breadcrumbs: ['数字字典管理', '字典管理'],
			},
			name: 'dictionaryManagement',
			component: () => import('@/views/common/dictionaryManagement/DictList')
		}, ]
	},

	{ // 首页默认菜单
		path: '/notificationAnnouncement',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '通知公告'],
			roles: ['system', 'student', 'teacher', 'bzr']
		},
		redirect: '/notificationAnnouncement/operationLog/index',
		children: [{
				//通知管理
				path: '/notificationAnnouncement/notice/index',
				meta: {
					title: '通知管理',
					roles: ['system', 'student', 'teacher', 'bzr', 'ceshi'],
					breadcrumbs: ['系统管理', '通知消息'],
				},
				name: 'notice',
				component: () => import('@/views/common/notice/index')
			},
			{
				//通知管理
				path: '/notificationAnnouncement/notice/content',
				meta: {
					title: '',
					roles: ['system', 'student', 'teacher', 'bzr'],
					breadcrumbs: ['系统管理', ''],
				},
				name: 'notice',
				component: () => import('@/views/common/notice/content')
			},
		]
	},

	{ // 首页默认菜单
		path: '/userRole',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '用户角色管理'],
			roles: ['system']
		},
		redirect: '/userRole/operationLog/index',
		children: [{
				//菜单管理
				path: '/sys/VeBaseSysMenuList',
				meta: {
					title: '菜单管理',
					roles: ['system'],
					breadcrumbs: ['用户角色管理', '菜单管理'],
				},
				name: 'menuConfiguration',
				component: () => import('@/views/sys/VeBaseSysMenuList')
			},
			{
				//用户管理
				path: '/userRole/operationLog/index',
				meta: {
					title: '用户管理',
					roles: ['system'],
					breadcrumbs: ['用户角色管理', '用户管理'],
				},
				name: 'operationLog',
				component: () => import('@/views/common/operationLog/index')
			},
			{
				//角色管理
				path: '/userRole/menuConfiguration/index',
				meta: {
					title: '角色管理',
					roles: ['system'],
					breadcrumbs: ['用户角色管理', '角色管理'],
				},
				name: 'menuConfiguration',
				component: () => import('@/views/common/menuConfiguration/index')
			},
			// {
			// 	path: '/common/permissionManage/index',
			// 	meta: {
			// 		title: '菜单管理',
			// 		roles: ['system'],
			// 		breadcrumbs: ['系统管理', '菜单管理'],
			// 	},
			// 	name: 'permissionManage',
			// 	component: () => import('@/views/common/permissionManage/index')
			// },
		]
	},
	{ // 首页默认菜单
		path: '/dictionary',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '数字字典管理'],
			roles: ['system']
		},
		redirect: '/dictionary/operationLog/index',
		children: [{
			//字典管理
			path: '/dictionary/dictionaryManagement/index',
			meta: {
				title: '字典管理',
				roles: ['system'],
				breadcrumbs: ['数字字典管理', '字典管理'],
			},
			name: 'dictionaryManagement',
			component: () => import('@/views/common/dictionaryManagement/DictList')
		}, ]
	},
	{ // 首页默认菜单
		path: '/log',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '日志管理'],
			roles: ['system']
		},
		redirect: '/common/log/index',
		children: [{
			//字典管理
			path: '/common/log/index',
			meta: {
				title: '日志管理',
				roles: ['system'],
				breadcrumbs: ['日志管理', '日志管理'],
			},
			name: 'logManagement',
			component: () => import('@/views/common/logManagement/index')
		}, ]
	},
	{ // 首页默认菜单
		path: '/document',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '文档管理'],
			roles: ['system']
		},
		redirect: '/common/documentManagement/index',
		children: [{
			//字典管理
			path: '/common/documentManagement/index',
			meta: {
				title: '文档管理',
				roles: ['system'],
				breadcrumbs: ['文档管理', '文档管理'],
			},
			name: 'documentManagement',
			component: () => import('@/views/common/documentManagement/index')
		}, ]
	},
	{ // 首页默认菜单
		path: '/interface',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '接口管理'],
			roles: ['system']
		},
		redirect: '/common/interface/index',
		children: [{
			//字典管理
			path: '/common/interface/index',
			meta: {
				title: '接口管理',
				roles: ['system'],
				breadcrumbs: ['接口管理', '接口管理'],
			},
			name: 'interfaceManagement',
			component: () => import('@/views/common/interfaceManagement/index')
		}, ]
	},
	{ // 首页默认菜单
		path: '/notificationAnnouncement',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '信息发布'],
			roles: ['system', 'student', 'teacher', 'bzr']
		},
		redirect: '/notificationAnnouncement/operationLog/index',
		children: [{
				//通知管理
				path: '/notificationAnnouncement/notice/index',
				meta: {
					title: '通知管理',
					roles: ['system', 'student', 'teacher', 'bzr', 'ceshi'],
					breadcrumbs: ['系统管理', '信息发布'],
				},
				name: 'notice',
				component: () => import('@/views/common/notice/index')
			},
			{
				//通知管理
				path: '/notificationAnnouncement/notice/content',
				meta: {
					title: '',
					roles: ['system', 'student', 'teacher', 'bzr'],
					breadcrumbs: ['系统管理', ''],
				},
				name: 'notice',
				component: () => import('@/views/common/notice/content')
			},
		]
	},

	{ // 首页默认菜单
		path: '/processManagement',
		component: Default,
		meta: {
			title: '系统管理',
			breadcrumbs: ['系统管理', '流程管理'],
			roles: ['system', 'bzr']
		},
		redirect: '/processManagement/operationLog/index',
		children: [
			// {
			// 	//流程表单管理
			// 	path: '/processManagement/processList/index',
			// 	meta: {
			// 		title: '流程申请',
			// 		roles: ['system'],
			// 		breadcrumbs: ['系统管理', '流程申请'],
			// 	},
			// 	name: 'processList',
			// 	component: () => import('@/views/common/processList/index')
			// },
			{
				//流程表单管理
				path: '/processManagement/processManagement/index',
				meta: {
					title: '流程管理',
					roles: ['system', 'bzr'],
					breadcrumbs: ['系统管理', '流程管理'],
				},
				name: 'processManagement',
				component: () => import('@/views/common/processManagement/index')
			},
			{
				//流程审批管理
				path: '/processManagement/processApprovals/index',
				meta: {
					title: '流程审批',
					roles: ['system', 'bzr'],
					breadcrumbs: ['系统管理', '流程审批'],
				},
				name: 'processApprovals',
				component: () => import('@/views/common/processApprovals/index')
			},
		]
	},


	// {
	// 	path: '/userInfo',
	// 	redirect: '/userInfo/info',
	// 	component: Default,
	// 	meta: {
	// 		title: '基本信息',
	// 		breadcrumbs: ['个人中心', '学籍信息'],
	// 		roles: ['system','student']
	// 	},
	// 	children: [{
	// 			path: '/userInfo/info',
	// 			meta: {
	// 				breadcrumbs: ['基本信息', '学籍信息'],
	// 				title: '学籍信息',
	// 				roles: ['system','student','teacher'],
	// 			},
	// 			component: () => import('@/views/user/userInfo/index')
	// 		},
	// 	]
	// },
]




const createRouter = () => new VueRouter({
	mode: 'hash',
	// mode: 'history', // require service support
	scrollBehavior: () => ({
		y: 0
	}),
	base: process.env.BASE_URL,
	routes: constantRouterMap
})

const router = createRouter()
router.beforeEach(async (to, from, next) => {
	// 触发获取菜单的 action
	if (localStorage.getItem('menus')) {
		let menus = JSON.parse(localStorage.getItem('menus'));
		menus.forEach((e) => {
			if (e.children && e.children.length > 0) {
				e.children.forEach((ite) => {
					if (ite.children) {
						ite.children.forEach((ii) => {
							if (ii.path === to.path) {
								store.commit('sidebar/SET_SIDEOBJ', ite);
								store.commit('sidebar/SET_NAVSELECTEDKEY', [ite
									.name]);
								store.commit('sidebar/SET_NAVITEMS', e.children);
								store.commit('sidebar/SET_SIDESELECTEDKEY', [ii
									.name]);
								store.commit('sidebar/SET_MENUSELECTEDKEY', [e
									.name]);
							}
						});
					}
				});
			} else {
				store.commit('sidebar/SET_SIDEOBJ', {});
				store.commit('sidebar/SET_NAVSELECTEDKEY', []);
				store.commit('sidebar/SET_NAVITEMS', []);
				store.commit('sidebar/SET_SIDESELECTEDKEY', []);
				store.commit('sidebar/SET_MENUSELECTEDKEY', [e.name]);
			}
		});
	}
	next();
});
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
	const newRouter = createRouter()
	router.matcher = newRouter.matcher // reset router
}

export default router